<!-- <template>
  <div style="height: 300px;">
  <el-dialog title="采购申请详情" :visible.sync="flowShow" @close = "closeDialog">
  <el-steps direction="vertical" :active=theStatus>
    <el-step title="员工提交"></el-step>
    <el-step title="部门经理审核"></el-step>
    <el-step title="总经理审核"></el-step>
    <el-step title="已办理"></el-step>
  </el-steps>
  <el-button @click="closeDialog">关闭</el-button>
  </el-dialog>
  </div>
</template>

<script>
export default {
    name:'process',
    props:{
        flowShow:Boolean,
        theStatus:Number
    },
    data(){
        
    },
    methods:{
        closeDialog(){
            this.dialogFormVisible = false
            //告诉父组件弹窗关闭，让父组件设置isShow为false
            this.$emit('closeDialog')
            //重置验证信息
            this.$refs['ruleForm'].resetFields();
        }
    },
    watch:{
        flowShow(val){
            //val代表父组件传递的新的isShow值
            this.dialogFormVisible = val
        },
        dialogFormVisible(val) {
            // 当弹窗关闭时通知父组件
            if (!val) {
                this.$emit('closeDialog')
            }
        }
    }

}
</script>

<style>

</style> -->


<template>
    <div style="height: 300px;">
      <el-dialog 
        title="采购申请详情" 
        :visible.sync="flowShow" 
        @close="closeDialog"
      >
        <el-steps direction="vertical" :active="theStatus">
          <el-step title="员工提交"></el-step>
          <el-step title="部门经理审核"></el-step>
          <el-step title="总经理审核"></el-step>
          <el-step title="已办理"></el-step>
        </el-steps>
        <el-button @click="closeDialog">关闭</el-button>
      </el-dialog>
    </div>
  </template>
  
  <script>
  export default {
      name:'process',
      props:{
          flowShow:Boolean,
          theStatus:Number
      },
      data(){
          return {
              // 修复：定义dialogFormVisible并初始化
              dialogFormVisible: false
          }
      },
      methods:{
          closeDialog(){
              // 1. 先更新本地弹窗状态
              this.dialogFormVisible = false;
              // 2. 通知父组件关闭（仅触发一次）
              this.$emit('closeDialog');
              // 修复：移除不存在的ruleForm引用
              // 原代码中没有表单，无需重置验证
          }
      },
      watch:{
          // 修复：仅通过flowShow单向同步状态
          flowShow(val){
              this.dialogFormVisible = val;
          },
          // 修复：移除冗余的双向同步逻辑
          dialogFormVisible(val) {
              if (!val) {
                  // 仅在弹窗实际关闭时通知父组件
                  this.$emit('closeDialog');
              }
          }
      }
  }
  </script>
  
  <style>
  </style>